LEADTOOLS Image Processing (Leadtools.ImageProcessing.Core assembly)
LEAD Technologies, Inc

CorrelationListCommand Constructor(RasterImage,LeadPoint[],Int32[],Int32,Int32,Int32)

Example 





RasterImage object that references the image(s) for which to search.
Array of Leadtools.LeadPoint objects to be updated with the starting points of the correlated areas.
Array of integers to be updated with the indices of the images that match correlated areas.
Step size in the X direction (along image width), in pixels. For best results, use 1.
Step size in the Y direction (along image height), in pixels. For best results, use 1.
Value that indicates the correlation threshold, which is a measure of the association necessary for two areas to be considered to be correlated. If the correlation value between an image in the list and an area in the reference image is less than the correlation threshold they are uncorrelated. Valid values range from 0 (zero resemblance) to 100 (perfect resemblance).
Initializes a new CorrelationListCommand with explicit parameters. .NET support WinRT support Silverlight support
Syntax
public CorrelationListCommand( 
   RasterImage correlationImage,
   LeadPoint[] points,
   int[] listIndex,
   int xStep,
   int yStep,
   int threshold
)
'Declaration
 
Public Function New( _
   ByVal correlationImage As RasterImage, _
   ByVal points() As LeadPoint, _
   ByVal listIndex() As Integer, _
   ByVal xStep As Integer, _
   ByVal yStep As Integer, _
   ByVal threshold As Integer _
)
'Usage
 
Dim correlationImage As RasterImage
Dim points() As LeadPoint
Dim listIndex() As Integer
Dim xStep As Integer
Dim yStep As Integer
Dim threshold As Integer
 
Dim instance As New CorrelationListCommand(correlationImage, points, listIndex, xStep, yStep, threshold)
public CorrelationListCommand( 
   RasterImage correlationImage,
   LeadPoint[] points,
   int[] listIndex,
   int xStep,
   int yStep,
   int threshold
)
function CorrelationListCommand( 
   correlationImage ,
   points ,
   listIndex ,
   xStep ,
   yStep ,
   threshold 
)
public:
CorrelationListCommand( 
   RasterImage^ correlationImage,
   array<LeadPoint>^ points,
   array<int>^ listIndex,
   int xStep,
   int yStep,
   int threshold
)

Parameters

correlationImage
RasterImage object that references the image(s) for which to search.
points
Array of Leadtools.LeadPoint objects to be updated with the starting points of the correlated areas.
listIndex
Array of integers to be updated with the indices of the images that match correlated areas.
xStep
Step size in the X direction (along image width), in pixels. For best results, use 1.
yStep
Step size in the Y direction (along image height), in pixels. For best results, use 1.
threshold
Value that indicates the correlation threshold, which is a measure of the association necessary for two areas to be considered to be correlated. If the correlation value between an image in the list and an area in the reference image is less than the correlation threshold they are uncorrelated. Valid values range from 0 (zero resemblance) to 100 (perfect resemblance).
Example
 
Public Sub CorrelationListConstructorExample()
   ' Load an image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   Dim copyRectangle As CopyRectangleCommand = New CopyRectangleCommand()

   Dim rc_cor As LeadRect = New LeadRect(327, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   Dim correlationImage As RasterImage = copyRectangle.DestinationImage.Clone()

   rc_cor = New LeadRect(283, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   correlationImage.AddPage(copyRectangle.DestinationImage.Clone())

   Dim points(30) As LeadPoint
   Dim listIndex(30) As Integer

   Dim command As CorrelationListCommand = New CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90)
   command.Run(image)

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void CorrelationListConstructorExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

      CopyRectangleCommand copyRectangle = new CopyRectangleCommand();

      LeadRect rc_cor = new LeadRect(327, 378, 22, 28);
      copyRectangle.Rectangle = rc_cor;
      copyRectangle.Run(image);
      RasterImage correlationImage = copyRectangle.DestinationImage.Clone();

      rc_cor = new LeadRect(283, 378, 22, 28);
      copyRectangle.Rectangle = rc_cor;
      copyRectangle.Run(image);
      correlationImage.AddPage(copyRectangle.DestinationImage.Clone());

      LeadPoint[] points = new LeadPoint[30];
      int[] listIndex = new int[30];

      CorrelationListCommand command = new CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90);
      command.Run(image);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
function CorrelationListConstructorExample()
{
   var codecs = new Leadtools.Codecs.RasterCodecs();
   codecs.throwExceptionsOnInvalidImages = true;

   // Load the image
   var srcFileName = "Assets\\Image1.cmp";
   return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) {
      return codecs.loadAsync(Leadtools.LeadStreamFactory.create(loadFile));
   }).then(function (image) {
      // Prepare the command
      with (Leadtools.ImageProcessing.Core) {
         var copyRectangle = new Leadtools.ImageProcessing.CopyRectangleCommand();

         var rc_cor = Leadtools.LeadRectHelper.create(327, 378, 22, 28);
         copyRectangle.rectangle = rc_cor;
         copyRectangle.run(image);
         var correlationImage = copyRectangle.destinationImage.clone();

         rc_cor = Leadtools.LeadRectHelper.create(283, 378, 22, 28);
         copyRectangle.rectangle = rc_cor;
         copyRectangle.run(image);
         correlationImage.addPage(copyRectangle.destinationImage.clone());

         var points = new Array();
         //Size the array to 30
         for (var i = 0; i < 30; i++)
            points[i] = Leadtools.LeadPointHelper.create(0, 0);

         var listIndex = new Array();
         //Size the array to 30
         for (var i = 0; i < 30; i++)
            listIndex[i] = 0;

         var command = new CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90);
         command.run(image);
      }
   });
}
[TestMethod]
public async Task CorrelationListConstructorExample()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;
   // Load the image
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   CopyRectangleCommand copyRectangle = new CopyRectangleCommand();

   LeadRect rc_cor = LeadRectHelper.Create(327, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   RasterImage correlationImage = copyRectangle.DestinationImage.Clone();

   rc_cor = LeadRectHelper.Create(283, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   correlationImage.AddPage(copyRectangle.DestinationImage.Clone());

   LeadPoint[] points = new LeadPoint[30];
   int[] listIndex = new int[30];

   CorrelationListCommand command = new CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90);
   command.Run(image);

}
public void CorrelationListConstructorExample(RasterImage image, Stream outStream)
{
   CopyRectangleCommand copyRectangle = new CopyRectangleCommand();
   LeadRect rc_cor = new LeadRect(327, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   RasterImage correlationImage = copyRectangle.DestinationImage.Clone();

   rc_cor = new LeadRect(283, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   correlationImage.AddPage(copyRectangle.DestinationImage.Clone());

   LeadPoint[] points = new LeadPoint[30];
   int[] listIndex = new int[30];

   CorrelationListCommand command = new CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90);
   command.Run(image);

   // Save result image
   RasterCodecs codecs = new RasterCodecs();
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
   image.Dispose();
}
Public Sub CorrelationListConstructorExample(ByVal image As RasterImage, ByVal outStream As Stream)
   Dim copyRectangle As CopyRectangleCommand = New CopyRectangleCommand()
   Dim rc_cor As LeadRect = New LeadRect(327, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   Dim correlationImage As RasterImage = copyRectangle.DestinationImage.Clone()

   rc_cor = New LeadRect(283, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   correlationImage.AddPage(copyRectangle.DestinationImage.Clone())

   Dim points As LeadPoint() = New LeadPoint(29){}
   Dim listIndex As Integer() = New Integer(29){}

   Dim command As CorrelationListCommand = New CorrelationListCommand(correlationImage, points, listIndex, 1, 1, 90)
   command.Run(image)

   ' Save result image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
   image.Dispose()
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CorrelationListCommand Class
CorrelationListCommand Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.